import {API} from './config';
import CustomRequest from '@/utils/Request'

/* 
* 获取机构层级列表
*/
const list = async () => {
  return CustomRequest({
    api: API.organizationList
  })
}

/* 
* 获取详情
*/
const detail = async (params) => {
  return await CustomRequest({
    api: API.organizationDetail,
    params
  })
}

/* 
* 获取所属机构
*/
const options = async () => {
  return await CustomRequest({
    api: API.organizationOptions
  })
}

/* 获取机构下的预算 */
const budget = async (id) => {
  return await CustomRequest({
    api: API.organizationBudget,
    params: {unitId: id}
  })
}

/* 获取机构下的清查任务 */
const checkBook = async (id) => {
  return await CustomRequest({
    api: API.organizationCheckBook,
    params: {unitId: id}
  })
}

export {
  list,
  detail,
  options,
  budget,
  checkBook
}